# coding=utf-8

from django.db import models
from app.model.ActivityModel import QyActivity
from rest_framework.serializers import ModelSerializer


# 留言
class QyMessage(models.Model):
    activity = models.ForeignKey(QyActivity,
                                null=True,
                                blank=True,
                                on_delete=models.SET_NULL,
                                to_field='id',
                                )
    member_id = models.IntegerField('留言人')
    message_img = models.ImageField('留言图片',
                                    upload_to='static/',
                                    blank=True
                                    )
    message_content = models.TextField('留言内容',blank=True)
    add_time = models.CharField('创建时间', max_length=20)

    class Meta:
        db_table = 'qy_message'
        verbose_name = '留言'
        verbose_name_plural = verbose_name


# 留言实体类
class MessageSerializers(ModelSerializer):

    class Meta:
        model = QyMessage
        fields = '__all__'